package com.Springdemo.service.Impl;

import com.Springdemo.dao.FruitMapper;
import com.Springdemo.enity.Fruit;
import com.Springdemo.enity.FruitExample;
import com.Springdemo.service.FruitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author: lool
 * @Date: 2022-06-09 16:35
 * @Description:
 */
@Service("FruitService")        //自动扫眉扫描装进bean容器中
public class FruitServiceImpl implements FruitService {
    @Autowired          //这个bean会被创建，根据初始化无参构造
    private FruitMapper fruitMapper;

    public FruitMapper getFruitMapper() {
        return fruitMapper;
    }

    public void setFruitMapper(FruitMapper fruitMapper) {
        this.fruitMapper = fruitMapper;
    }

    @Override
    public List<Fruit> findAllFruit() {
        FruitExample example=new FruitExample();
        FruitExample.Criteria criteria=example.createCriteria();

        List<Fruit> list=fruitMapper.selectByExample(example);
        System.out.println("查询所有水果成功");
        return list;
    }
}
